690 research outputs found
Tracing monadic computations and representing effects
In functional programming, monads are supposed to encapsulate computations,
effectfully producing the final result, but keeping to themselves the means of
acquiring it. For various reasons, we sometimes want to reveal the internals of
a computation. To make that possible, in this paper we introduce monad
transformers that add the ability to automatically accumulate observations
about the course of execution as an effect. We discover that if we treat the
resulting trace as the actual result of the computation, we can find new
functionality in existing monads, notably when working with non-terminating
computations.Comment: In Proceedings MSFP 2012, arXiv:1202.240
The new (liberal) eugenics
Despite the Nazi horrors, in 1953 the new eugenics was founded, when Watson and Crick postulated the double helix of DNA as the basis of chemical heredity. In 1961, scientists have deciphered the genetic code of DNA, laying the groundwork for code manipulation and the potential building of new life forms. After thirty years from the discovery of the DNA structure, the experimenters began to carry out the first clinical studies of human somatic cell therapy.
The practice of prenatal genetic tests identifies genes or unwanted genetic markers. Parents can choose to continue pregnancy or give up the fetus. Once the preimplantation genetic diagnosis occurs, potential parents can choose to use in vitro fertilization and then test early embryonic cells to identify embryos with genes they prefer or avoid. Because of concerns about eugenics, genetic counseling is based on a "non-directive" policy to ensure respect for reproductive autonomy. The argument for this counseling service is that we should balance parental autonomy with child's autonomy in the future. Specialists have not yet given a clear answer to the question of whether these practices should be considered eugenic practices, or if they are moral practices.
DOI: 10.13140/RG.2.2.28777.9584
Maximum Segment Sum, Monadically (distilled tutorial, with solutions)
The maximum segment sum problem is to compute, given a list of integers, the
largest of the sums of the contiguous segments of that list. This problem
specification maps directly onto a cubic-time algorithm; however, there is a
very elegant linear-time solution too. The problem is a classic exercise in the
mathematics of program construction, illustrating important principles such as
calculational development, pointfree reasoning, algebraic structure, and
datatype-genericity. Here, we take a sideways look at the datatype-generic
version of the problem in terms of monadic functional programming, instead of
the traditional relational approach; the presentation is tutorial in style, and
leavened with exercises for the reader.Comment: Revision of the article in Proceedings DSL 2011, EPTCS 66,
arXiv:1109.0323, to provide solutions to the exercise
Refactoring pattern matching
Defining functions by pattern matching over the arguments is advantageous for understanding and reasoning, but it tends to expose the implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to program refactoring based on a right-invertible language rinv—every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation, while maintaining simple and sound reasoning
The Generic Approximation Lemma
The approximation lemma is a simplification of the well-known take lemma, and is used to prove properties of programs that produce lists of values. We show how the approximation lemma, unlike the take lemma, can naturally be generalised from lists to a large class of datatypes, and present a generic approximation lemma that is parametric in the datatype to which it applies. As a useful by-product, we find that generalising the approximation lemma in this way also simplifies its proof
On Ontologology
The study of models, and related concepts such as metamodels, is largely situated within the software engineering community under the banner of model-driven development. Yet these concepts have some obvious parallels with concepts developed within the artificial intelligence community under the banners of ontologies and the semantic web. Although a considerable amount of work has been done that aims to relate the development of ontologies to the model-driven development of software, the place of bidirectional transformations within these connected worlds is (almost) unstudied. Yet, experts in the study of ontologies have experienced the need to check and restore consistency, and have developed techniques, terminology and tools that relate to these tasks. In this paper we provide a high-level introduction to the work that has been done, aiming to promote further study and perhaps collaboration between these communities
Relative contribution of abundant and rare species to species–energy relationships
A major goal of ecology is to understand spatial variation in species richness. The latter is markedly influenced by energy availability and appears to be influenced more by common species than rare ones; species–energy relationships should thus be stronger for common species. Species–energy relationships may arise because high-energy areas support more individuals, and these larger populations may buffer species from extinction. As extinction risk is a negative decelerating function of population size, this more-individuals hypothesis (MIH) predicts that rare species should respond more strongly to energy. We investigate these opposing predictions using British breeding bird data and find that, contrary to the MIH, common species contribute more to species–energy relationships than rare ones
When is a function a fold or an unfold?
We give a necessary and sufficient condition for when a set-theoretic function can be written using the recursion operator fold, and a dual condition for the recursion operator unfold. The conditions are simple, practically useful, and generic in the underlying datatype
- …